import {Component, Input, OnInit, TemplateRef, ViewChild} from '@angular/core';

import {DomSanitizer, SafeResourceUrl} from "@angular/platform-browser";
import {NzModalRef, NzModalService} from 'ng-zorro-antd/modal';
import {FetchService} from "../../../core/net/fetch.service";

@Component({
  selector: 'app-left-top-panel',
  templateUrl: './left-top-panel.component.html',
  styleUrls: ['./left-top-panel.component.scss']
})
export class LeftTopPanelComponent implements OnInit {
  @Input() type: string = 'river';
  hhgl; // 黄河干流;
  hhzl; // 黄河支流;
  dxs; // 地下水;
  fcgs; // 非常规水;
  ljhs; // 累计耗水
  sjys; // 实际引水
  qszl; // 取水总量
  constructor(private sanitizer: DomSanitizer,
              private fetchService: FetchService,
              private modal: NzModalService) {
  }

  ngOnInit(): void {

    /* // 引水量
     this.fetchService.post<any>('muw/wrsMuwIrrData/statisticWater', {}).subscribe(res => {
       this.hhgl = res.val;
     });*/

    // 累计耗水
    this.fetchService.post<any>('wrs/wrsBrstadia/sumUseFlux', {}).subscribe(res => {
      this.ljhs = res.val;
    });

    // 实际引水
    this.fetchService.post<any>('muw/wrsMuwIrrData/statisticWater', {}).subscribe(res => {
      this.sjys = res.val;
    });

    // 实际引水
    this.fetchService.post<any>('sys/sysApiInfo/queryApiData', {apicode: 26}).subscribe(res => {
      res.map(item => {
        if (item.name == '黄河干流') {
          this.hhgl = item.useVal;
        }
        if (item.name == '黄河支流') {
          this.hhzl = item.useVal;
        }
        if (item.name == '地下水') {
          this.dxs = item.useVal;
        }
        if (item.name == '非常规水') {
          this.fcgs = item.useVal;
        }
      });
    });
  }


}
